Add reftests for center layout
authorMatthias Clasen <mclasen@redhat.com>
Mon, 24 Aug 2020 16:02:34 +0000 (12:02 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 24 Aug 2020 16:02:34 +0000 (12:02 -0400)
Add a test that checks behavior with invisible children,
and another one that ensures we go back to box-like
layout if min-size is forced.

testsuite/reftests/centerlayout-invisible-child.css [new file with mode: 0644]
testsuite/reftests/centerlayout-invisible-child.ref.ui [new file with mode: 0644]
testsuite/reftests/centerlayout-invisible-child.ui [new file with mode: 0644]
testsuite/reftests/centerlayout-minsize.css [new file with mode: 0644]
testsuite/reftests/centerlayout-minsize.ref.ui [new file with mode: 0644]
testsuite/reftests/centerlayout-minsize.ui [new file with mode: 0644]
testsuite/reftests/meson.build

diff --git a/testsuite/reftests/centerlayout-invisible-child.css b/testsuite/reftests/centerlayout-invisible-child.css
new file mode 100644 (file)
index 0000000..9e5d48a
--- /dev/null
@@ -0,0 +1,3 @@
+box {
+  border-spacing: 10px;
+}
diff --git a/testsuite/reftests/centerlayout-invisible-child.ref.ui b/testsuite/reftests/centerlayout-invisible-child.ref.ui
new file mode 100644 (file)
index 0000000..fc1055a
--- /dev/null
@@ -0,0 +1,21 @@
+<!-- check that an invisible child does not influence the layout -->
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window_information_collection">
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkCenterBox" id="box1">
+        <child type="start">
+          <object class="GtkLabel" id="label1">
+            <property name="label" translatable="yes">Hello, Hello</property>
+          </object>
+        </child>
+        <child type="end">
+          <object class="GtkLabel" id="label3">
+            <property name="label" translatable="yes">World</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/centerlayout-invisible-child.ui b/testsuite/reftests/centerlayout-invisible-child.ui
new file mode 100644 (file)
index 0000000..3088847
--- /dev/null
@@ -0,0 +1,27 @@
+<!-- check that an invisible child does not influence the layout -->
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window_information_collection">
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkCenterBox" id="box1">
+        <child type="start">
+          <object class="GtkLabel" id="label1">
+            <property name="label" translatable="yes">Hello, Hello</property>
+          </object>
+        </child>
+        <child type="center">
+          <object class="GtkLabel" id="label2">
+            <property name="visible">0</property>
+            <property name="label" translatable="yes">cruel</property>
+          </object>
+        </child>
+        <child type="end">
+          <object class="GtkLabel" id="label3">
+            <property name="label" translatable="yes">World</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/centerlayout-minsize.css b/testsuite/reftests/centerlayout-minsize.css
new file mode 100644 (file)
index 0000000..9e5d48a
--- /dev/null
@@ -0,0 +1,3 @@
+box {
+  border-spacing: 10px;
+}
diff --git a/testsuite/reftests/centerlayout-minsize.ref.ui b/testsuite/reftests/centerlayout-minsize.ref.ui
new file mode 100644 (file)
index 0000000..8791443
--- /dev/null
@@ -0,0 +1,26 @@
+<!-- check that an invisible child does not influence the layout -->
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window_information_collection">
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkBox" id="box1">
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="label" translatable="yes">Hello, Hello</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label2">
+            <property name="label" translatable="yes">cruel</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label3">
+            <property name="label" translatable="yes">World</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/centerlayout-minsize.ui b/testsuite/reftests/centerlayout-minsize.ui
new file mode 100644 (file)
index 0000000..7f11882
--- /dev/null
@@ -0,0 +1,27 @@
+<!-- check that an invisible child does not influence the layout -->
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window_information_collection">
+    <property name="decorated">0</property>
+    <property name="default-width">20</property>
+    <child>
+      <object class="GtkCenterBox" id="box1">
+        <child type="start">
+          <object class="GtkLabel" id="label1">
+            <property name="label" translatable="yes">Hello, Hello</property>
+          </object>
+        </child>
+        <child type="center">
+          <object class="GtkLabel" id="label2">
+            <property name="label" translatable="yes">cruel</property>
+          </object>
+        </child>
+        <child type="end">
+          <object class="GtkLabel" id="label3">
+            <property name="label" translatable="yes">World</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
index a6a5210a773e30e1a1d9df7220c25e5683bb705f..0e8bdbc16e36d62c3c51f16a5ecdcf66856ca67c 100644 (file)
@@ -163,6 +163,12 @@ testdata = [
   'box-shadow-with-blend-mode.ui',
   'button-wrapping.ui',
   'button-wrapping.ref.ui',
+  'centerlayout-invisible-child.css',
+  'centerlayout-invisible-child.ref.ui',
+  'centerlayout-invisible-child.ui',
+  'centerlayout-minsize.css',
+  'centerlayout-minsize.ref.ui',
+  'centerlayout-minsize.ui',
   'color-transition.css',
   'color-transition.ref.ui',
   'color-transition.ui',